<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="it.apuliait.model.Documento"%>
<%@page import="it.apuliait.service.DocumentoLocalServiceUtil"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="it.apuliait.model.Pagamenti"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="javax.portlet.ActionRequest"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.ui.core.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/ui.datepicker-it.js"></script>
<link href="<%= request.getContextPath() %>/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/ui.datepicker.css" rel="stylesheet" type="text/css" />

<portlet:defineObjects />
<%
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
PortletURL aggiungiDatiPagamentoURL = renderResponse.createActionURL();
aggiungiDatiPagamentoURL.setParameter(ActionRequest.ACTION_NAME, "aggiungiDatiPagamento");
aggiungiDatiPagamentoURL.setParameter("action", "UPDATE");
Pagamenti p = (Pagamenti)renderRequest.getAttribute("pagamento");
aggiungiDatiPagamentoURL.setParameter("documentoId", String.valueOf(p.getDocumentoIDFK()));
SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy");

Documento documento = DocumentoLocalServiceUtil.getDocumento(p.getDocumentoIDFK());

%>
<script type="text/javascript">
$(document).ready(function(){
 	$('#datepicker').datepicker({ dateFormat: 'yy-mm-dd' });
  }); 
  $(document).ready(function(){
	 	$('#datepicker1').datepicker({ dateFormat: 'yy-mm-dd' });
	  }); 
  $(document).ready(function(){
	 	$('#datepicker2').datepicker({ dateFormat: 'yy-mm-dd' });
	  }); 
  $(document).ready(function(){
	 	$('#datepicker3').datepicker({ dateFormat: 'yy-mm-dd' });
	  });

  
</script>
<form action="<%= aggiungiDatiPagamentoURL %>" method="post">
	<table border="0" width="100%">
		<tr>
			<td colspan="5" style="border-bottom-style: solid; border-bottom-color: #118ADE;">
				<table width="100%">
					<tr>
						<td><B>MODALITA' DI PAGAMENTO PER IL DOCUMENTO:</B> <%= documento.getNomeDocumento() %></td>
						<td align="right" colspan="4"><b>TOTALE:</b> <%= p.getImportoPagamento() %> &euro;</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td>CONDIZIONI DI PAGAMENTO</td>
			<td colspan="4">
				<select name="<portlet:namespace />condizioniPagamento" style="width: 100%">
					<% if(p.getCondizioniPagamento().equals("TP01")){ %>
					<option value="TP01" selected="selected">PAGAMENTO A RATE</option>
					<% } else if(p.getCondizioniPagamento().equals("TP02")){ %>
					<option value="TP02" selected="selected">PAGAMENTO COMPLETO</option>
					<% } else if(p.getCondizioniPagamento().equals("TP03")){ %>
					<option value="TP03" selected="selected">ANTICIPO</option>
					<% } %>
					<option></option>
					<option value="TP01">PAGAMENTO A RATE</option>
					<option value="TP02">PAGAMENTO COMPLETO</option>
					<option value="TP03">ANTICIPO</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>BENEFICIARIO</td>
			<td colspan="4"><input type="text" name="<portlet:namespace />beneficiario" value="<%= p.getBeneficiario() %>" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>MODALITA PAGAMENTO</td>
			<td colspan="4">
				<select name="<portlet:namespace />modalitaPagamento" style="width: 80%">
					<% if(p.getModalitaPagamento().equals("MP01")){ %>
					<option value="MP01" selected="selected">CONTANTI</option>
					<% } else if(p.getModalitaPagamento().equals("MP02")){ %>
					<option value="MP02" selected="selected">ASSEGNO</option>	
					<% } else if(p.getModalitaPagamento().equals("MP03")){ %>
					<option value="MP03" selected="selected">ASSEGNO CIRCOLARE</option>
					<% } else if(p.getModalitaPagamento().equals("MP04")){ %>
					<option value="MP04" selected="selected">CONTANTI PRESSO TESORERIA</option>
					<% } else if(p.getModalitaPagamento().equals("MP05")){ %>
					<option value="MP05" selected="selected">BONIFICO</option>
					<% } else if(p.getModalitaPagamento().equals("MP06")){ %>
					<option value="MP06" selected="selected">VAGLIA CAMBIARIO</option>
					<% } else if(p.getModalitaPagamento().equals("MP07")){ %>
					<option value="MP07" selected="selected">BOLLETTINO BANCARIO</option>
					<% } else if(p.getModalitaPagamento().equals("MP08")){ %>
					<option value="MP08" selected="selected">CARTA DI PAGAMENTO</option>
					<% } else if(p.getModalitaPagamento().equals("MP09")){ %>
					<option value="MP09" selected="selected">RID</option>
					<% } else if(p.getModalitaPagamento().equals("MP010")){ %>
					<option value="MP010" selected="selected">RID UTENZE</option>
					<% } else if(p.getModalitaPagamento().equals("MP011")){ %>
					<option value="MP011" selected="selected">RID VELOCE</option>
					<% } else if(p.getModalitaPagamento().equals("MP012")){ %>
					<option value="MP012" selected="selected">RIBA</option>
					<% } else if(p.getModalitaPagamento().equals("MP013")){ %>
					<option value="MP013" selected="selected">MAV</option>
					<% } else if(p.getModalitaPagamento().equals("MP014")){ %>
					<option value="MP014" selected="selected">QUIETANZA ERARIO</option>
					<% } else if(p.getModalitaPagamento().equals("MP015")){ %>
					<option value="MP015" selected="selected">GIROCONTO SU CONTI DI CONTABILITA SPECIALE</option>
					<% } else if(p.getModalitaPagamento().equals("MP016")){ %>
					<option value="MP016" selected="selected">DOMICILIAZIONE BANCARIA</option>
					<% } else if(p.getModalitaPagamento().equals("MP017")){ %>
					<option value="MP017" selected="selected">DOMICILIAZIONE POSTALE</option>
					<% } else if(p.getModalitaPagamento().equals("MP018")){ %>
					<option value="MP018" selected="selected">BOLLETTINO CI C/C POSTALE</option>
					<% } else if(p.getModalitaPagamento().equals("MP019")){ %>
					<option value="MP019" selected="selected">SEPA DIRECT DEBIT</option>
					<% } else if(p.getModalitaPagamento().equals("MP020")){ %>
					<option value="MP020" selected="selected">SEPA DIRECT DEBIT CORE</option>
					<% } else if(p.getModalitaPagamento().equals("MP021")){ %>
					<option value="MP021" selected="selected">SEPA DIRECT DEBIT B2B</option>
					<% } %>
					<option></option>
					<option value="MP01">CONTANTI</option>
					<option value="MP02">ASSEGNO</option>
					<option value="MP03">ASSEGNO CIRCOLARE</option>
					<option value="MP04">CONTANTI PRESSO TESORERIA</option>
					<option value="MP05">BONIFICO</option>
					<option value="MP06">VAGLIA CAMBIARIO</option>
					<option value="MP07">BOLLETTINO BANCARIO</option>
					<option value="MP08">CARTA DI PAGAMENTO</option>
					<option value="MP09">RID</option>
					<option value="MP010">RID UTENZE</option>
					<option value="MP011">RID VELOCE</option>
					<option value="MP012">RIBA</option>
					<option value="MP013">MAV</option>
					<option value="MP014">QUIETANZA ERARIO</option>
					<option value="MP015">GIROCONTO SU CONTI DI CONTABILITA SPECIALE</option>
					<option value="MP016">DOMICILIAZIONE BANCARIA</option>
					<option value="MP017">DOMICILIAZIONE POSTALE</option>
					<option value="MP018">BOLLETTINO CI C/C POSTALE</option>
					<option value="MP019">SEPA DIRECT DEBIT</option>
					<option value="MP020">SEPA DIRECT DEBIT CORE</option>
					<option value="MP021">SEPA DIRECT DEBIT B2B</option>
				</select>
			</td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5" style="border-bottom-style: solid; border-bottom-color: #118ADE"><B>BONIFICO BANCARIO</B></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">NOME BANCA</td>
			<td colspan="4"><input type="text" name="<portlet:namespace />istitutoFinanziario" value="<%= p.getIstitutoFinanziario() %>" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>IBAN</td>
			<td colspan="4"><input type="text" name="<portlet:namespace />iban" value="<%= p.getIban() %>" id="iban" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>ABI</td>
			<td><input type="text" name="<portlet:namespace />abi" size="5" value="<%= p.getAbi() %>" id="abi" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>CAB</td>
			<td><input type="text" name="<portlet:namespace />cab" size="5" value="<%= p.getCab() %>" id="cab" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>BIC</td>
			<td colspan="4"><input type="text" name="<portlet:namespace />bic" value="<%= p.getBic() %>" id="bic" size="11" style="width: 80%" /></td>
		</tr>
		<tr>
			<td colspan="5" style="border-bottom-style: solid; border-bottom-color: #118ADE"><B>UFFICIO POSTALE</B></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td>CODICE UFFICIO POSTALE</td>
			<td><input type="text" name="<portlet:namespace />codUfficioPostale" size="5" value="<%= p.getCodUfficioPostale() %>" id="abi" style="width: 80%" /></td>
		</tr>
		<tr>
			<td colspan="5" style="border-bottom-style: solid; border-bottom-color: #118ADE"><B>CONTANTI</B></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td>COGNOME QUETANZIANTE</td>
			<td><input type="text" name="<portlet:namespace />cognomeQuetanziante" size="5" value="<%= p.getCognomeQuet() %>" id="abi" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>NOME QUETANZIANTE</td>
			<td><input type="text" name="<portlet:namespace />nomeQuetanziante" size="5" value="<%= p.getNomeQuet() %>" id="abi" style="width: 80%" /></td>
		</tr>
		<tr>
			<td>CODICE FISCALE QUETANZIANTE</td>
			<td><input type="text" name="<portlet:namespace />CFQuetanziante" size="5" value="<%= p.getCfQuet() %>" id="abi" style="width: 80%" /></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5"><input type="submit" value="Salva" /></td>
		</tr>
	</table>
</form>